import {createRouter, createWebHistory} from 'vue-router'

import HomePage from "@/pages/HomePage.vue";
import LoginPage from "@/pages/user/LoginPage.vue";
import RegisterPage from "@/pages/user/RegisterPage.vue";
import UserManagePage from "@/pages/admin/UserManagePage.vue";
import TeamManagePage from "@/pages/admin/TeamManagePage.vue";
import MatchPage from "@/pages/MatchPage.vue";
import TeamAddPage from "@/pages/team/TeamAddPage.vue";
import TeamPage from "@/pages/team/TeamPage.vue";
import UserDetailPage from "@/pages/user/UserDetailPage.vue";
import BlogPage from "@/pages/blog/BlogPage.vue";
import BlogDetailPage from "@/pages/blog/BlogDetailPage.vue";
import AIChatPage from "@/pages/AI/AIChatPage.vue";
import BlogAddPage from "@/pages/blog/BlogAddPage.vue";
import BlogManagePage from "@/pages/admin/BlogManagePage.vue";
import ChatPage from "@/pages/chat/ChatPage.vue";
import TeamDetailPage from "@/pages/team/TeamDetailPage.vue";

const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL),
    routes: [
        {
            path: '/',
            name: 'home',
            component: HomePage,
        },
        {
            path: '/login',
            name: 'login',
            component: LoginPage,
        },
        {
            path: '/register',
            name: 'register',
            component: RegisterPage,
        },
        {
            path: '/user/:id',
            name: 'userDetail',
            component: UserDetailPage,
        },
        {
            path: '/admin/userManage',
            name: 'userManage',
            component: UserManagePage,
        },
        {
            path: '/admin/teamManage',
            name: 'teamManage',
            component: TeamManagePage,
        },
        {
            path: '/admin/blogManage',
            name: 'blogManage',
            component: BlogManagePage,
        },
        {
            path: '/match',
            name: 'match',
            component: MatchPage,
        },
        {
            path: '/blog',
            name: 'blog',
            component: BlogPage,
        },
        {
            path: '/blog/add',
            name: 'blogAdd',
            component: BlogAddPage,
        },
        {
            path: '/blog/:id',
            name: 'blogDetail',
            component: BlogDetailPage,
        },
        {
            path: '/team',
            name: 'team',
            component: TeamPage,
        },
        {
            path: '/team/add',
            name: 'teamAdd',
            component: TeamAddPage,
        },
        {
            path: '/team/:id',
            name: 'teamDetail',
            component: TeamDetailPage,
        },
        {
            path: '/chat',
            name: 'chat',
            component: ChatPage,
        },
        {
            path: '/AI/chat',
            name: 'AIChat',
            component: AIChatPage,
        },
        {
            path: '/about',
            name: 'about',
            // route level code-splitting
            // this generates a separate chunk (About.[hash].js) for this route
            // which is lazy-loaded when the route is visited.
            component: () => import('../views/AboutView.vue'),
        },
    ],
})

export default router
